<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>setTimeout延时器</title>
    <style>
        div {
            margin: 200px auto;
            background: pink;
            width: 1000px;
            height: 200px;
            text-align: center;
            line-height: 200px;
            font-size: 40px;
        }
    </style>
</head>
<body>
    <div></div>

    <script>
        const div = document.querySelector('div')
        
        setTimeout(() => {
            div.style.display = 'none'
        },3000)

        let count = 3
        setInterval(() => {
            div.innerHTML = `我是广告(${--count}s后自动关闭)`
        }, 1000);

    </script>
</body>
</html>